package com.fansl.allround.common.log;

import com.fansl.allround.common.log.aspect.SysLogAspect;
import com.fansl.allround.common.log.event.SysLogListener;
import com.fansl.allround.upms.api.feign.RemoteLogService;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;

/**
 * @author fansl
 * @Description: 日志自动配置
 * @date 2019/7/11 17:10
 */
@EnableAsync
@Configuration
@AllArgsConstructor
@ConditionalOnWebApplication
public class LogAutoConfiguration {
    private final RemoteLogService remoteLogService;
    @Bean
    public SysLogListener sysLogListener(){
        return new SysLogListener(remoteLogService);
    }
    @Bean
    public SysLogAspect sysLogAspect() {
        return new SysLogAspect();
    }
}
